package com.it.base.thread.pool.newFixedThreadPoolDemo;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 创建一个定长线程池，可控制线程最大并发数，超出的线程会在队列中等待。
 */
public class MyNewFixedThreadPoolExecutor {
    // 固定线程数量
    private static ExecutorService executorService=   Executors.newFixedThreadPool(10);

    public static void main(String[] args) {
        for (int i=0;i<100;i++){

            executorService.execute(()->System.out.println(Thread.currentThread().getName()));
        }
    }
}
